﻿using System;
using Autodesk.Revit.DB;
using YArchitech.Revit;

namespace YJKDimensionModel.SymbolTextSetting
{
	public class GridTypeParameter
	{
		public int GridBubbleEnd1 { get; set; }

		public int GridBubbleEnd2 { get; set; }

		private GridType m_GridType { get; set; }

		public GridTypeParameter(GridType gridType)
		{
			this.m_GridType = gridType;
			this.InitPara();
		}

		private void InitPara()
		{
			if (this.m_GridType != null)
			{
				Parameter parameter = this.m_GridType.GetParameter(BuiltInParameter.GRID_BUBBLE_END_1);
				if (parameter != null)
				{
					this.GridBubbleEnd1 = parameter.AsInteger();
				}
				Parameter parameter2 = this.m_GridType.GetParameter(BuiltInParameter.GRID_BUBBLE_END_2);
				if (parameter2 != null)
				{
					this.GridBubbleEnd2 = parameter2.AsInteger();
				}
			}
		}

		public void SetPara(GridType gridType)
		{
			if (this.m_GridType != null)
			{
				Parameter parameter = gridType.GetParameter(BuiltInParameter.GRID_BUBBLE_END_1);
				if (parameter != null)
				{
					parameter.Set(this.GridBubbleEnd1);
				}
				Parameter parameter2 = gridType.GetParameter(BuiltInParameter.GRID_BUBBLE_END_2);
				if (parameter2 != null)
				{
					parameter2.Set(this.GridBubbleEnd2);
				}
			}
		}
	}
}
